home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / Libraries / Std I⁄O for C / test sf_stdio.c < prev   
C/C++ Source or Header  |  1988-03-02  |  498b  |  31 lines

  1. /* test sf_stdio.c 
  2.  * 
  3.  * Chris Borton, 27 February 1988
  4.  * Prompt for text file with SFGetFile and use that as a stream of input
  5.  * like stdin.  
  6.  */
  7.  
  8. #include <stdio.h>
  9. #include <proto.h>
  10. #include "sf_stdio.h"
  11.  
  12. int main(void);
  13.  
  14. main()
  15. {
  16.     char c;
  17.     
  18.     printf("Starting up...\n");
  19.     
  20.     if (sf_stdin()) {
  21.         while ((c = getc(stdin)) != EOF)
  22.             printf("%c",c);
  23.     }
  24.  
  25.     printf("Now choose an output file and type until 'q':\n\n");
  26.     
  27.     if (sf_stdout()) {
  28.         while ((c = getch()) != 'q')
  29.             fputc(c,stdout);
  30.     }
  31. }